/**
 * this class defines electronics' basic properties and methods
 * @author junyu33
 * @ver 1.0.0
 */

package base;

public class Electronics {
    private double weight;
    private double price;
    private double power;
    private String manufacturer;

    /**
     * construct method
     * @param initWeight
     * @param initPrice
     * @param initPower
     * @param initManufacturer
     */
    public Electronics(double initWeight, double initPrice, double initPower, String initManufacturer) {
        try {
            this.weight = initWeight;
            this.price = initPrice;
            this.power = initPower;
        } catch (Exception e) {
            System.out.println("Invalid input");
        }
        this.manufacturer = initManufacturer;
    }
    /**
     * set device's weight
     * @param new_weight
     */
    public void setWeight(double new_weight) {
        try {
            this.weight = new_weight;
        } catch (Exception e) {
            System.out.println("input must be a number");
        }
    }

    /**
     * set device's price
     * @param new_price
     */
    public void setPrice(double new_price) {
        try {
            this.price = new_price;
        } catch (Exception e) {
            System.out.println("input must be a number");
        }
    }

    /**
     * set device's power
     * @param new_power
     */
    public void setPower(double new_power) {
        try {
            this.power = new_power;
        } catch (Exception e) {
            System.out.println("input must be a number");
        }
    }

    /**
     * output device's all information
     */
    public void outputInfo() {
        System.out.println("weight: " + this.weight);
        System.out.println("price: " + this.price);
        System.out.println("power: " + this.power);
    }
}
